package my.graduation.controller.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import my.graduation.dto.DoctorInfoDto;
import my.graduation.result.Result;
import my.graduation.service.DoctorService;
import my.graduation.vo.DoctorVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: RavenLyn
 * @Date: 2024-12-11
 */
@RestController
@RequestMapping("/admin/doctor")
public class AdmDoctorController {

    @Autowired
    private DoctorService doctorService;
//    /**
//     * 获取医生信息
//     * @return
//     */
//    @GetMapping
//    public Result<Page<DoctorVO>> list(@RequestParam(defaultValue = "1") int pageNum,
//                                       @RequestParam(defaultValue = "6") int pageSize) {
//        return doctorService.getList(pageNum, pageSize);
//    }
//
//    /**
//     * 条件获取医生信息
//     * @param dto
//     * @return
//     */
//    @PostMapping("/con")
//    public Result<Page<DoctorVO>> listByCon(@RequestBody DoctorInfoDto dto,
//                                            @RequestParam(defaultValue = "1") int pageNum,
//                                            @RequestParam(defaultValue = "6") int pageSize) {
//        return doctorService.getListByCon(dto, pageNum, pageSize);
//    }


    /**
     * 获取医生信息
     * @return
     */
    @GetMapping
    public Result<List<DoctorVO>> list(){
        return doctorService.getList();
    }

    /**
     * 条件获取医生信息
     * @param dto
     * @return
     */
    @PostMapping("/con")
    public Result<List<DoctorVO>> list(@RequestBody DoctorInfoDto dto){
        return doctorService.getListByCon(dto);
    }
    /**
     * 新增医生信息
     * @return
     */
    @PostMapping
    public Result add(@RequestBody DoctorInfoDto dto){
        return doctorService.add(dto);
    }

    /**
     * 修改医生信息
     * @return
     */
    @PutMapping
    public Result update(@RequestBody DoctorInfoDto dto){
        return doctorService.update(dto);
    }

    /**
     * 删除医生信息
     * @return
     */
    @DeleteMapping
    public Result delete(@RequestBody DoctorInfoDto dto){
        return doctorService.delete(dto);
    }


}
